home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / love4th.zip / STARTING.DOC < prev    next >
Text File  |  1991-10-01  |  10KB  |  205 lines

  1. Notes on the Book 'Starting Forth' by Brodie
  2. --------------------------------------------
  3.         L.O.V.E. Forth matches closely the Forth 83 standard, as does
  4. the book 'Starting Forth'.   Here are some notes on differences between
  5. L.O.V.E. Forth and the words and examples described in this book (2nd
  6. edition is assumed).  Remember to type HELP (wordname) or the Alt-F1 
  7. key if you have any difficulty.
  8.  
  9. Chapter 3   Working with Forth
  10. ---------
  11.         It is necessary to have the block disk words included in
  12. L.O.V.E.  Forth in order to use many of the words described in this
  13. chapter.  The shareware DEMO program has these included.  To include
  14. them in BARE system type:  INCLUDE" LOADBLK.TXT" (enter) .  Many users 
  15. will, of coarse, prefer to use text files using their favorite text 
  16. editor to compose programs.
  17.  
  18.         To open a new screens file when using block disk words type:
  19. OPEN-NEW" myfile.scr" (enter)  . This will create a brand new file named
  20. MYFILE.SCR (or the name of your choice).  To extend the file to include
  21. more screens, type:   n SCREENS (enter)   where n is the total number you
  22. want (maximum is 32767, but don't type that many unless you have a BIG 
  23. disk).   For more information see the file SOURCE.DOC.
  24.  
  25.         To switch on the printer type the word PR-ON.  This causes all
  26. activity to be both printed and displayed.  Type PR-OFF when done.  The
  27. printer LPT1 is used.
  28.  
  29.         There is a word called   L   which is like   LIST   but is
  30. much faster.  LN lists the next screen up, LB lists back one, and EL
  31. edits the current last screen displayed in this way (see EDITOR below).
  32. There is no word TRIAD.  The word SHOW displays a range of screens
  33. rapidly on the display.  To use it type the first screen and last
  34. screen followed by the word SHOW.
  35.  
  36.         The EDITOR described in 'Starting Forth' is antiquated and is no
  37. longer used in most forth systems.  L.O.V.E. Forth has a full screen
  38. (one screen) editor with cursor control and other features.  To use it
  39. type:  n EDIT where n is the screen number you wish to edit.  Type
  40. Ctrl-X  to get help.
  41.  
  42. Chapter 7   A number of kinds of numbers
  43. ---------
  44.         L.O.V.E. Forth stores the decimal place in a variable called
  45. DPL.  If no decimal point was used in the last number converted, DPL
  46. contains -1.
  47.  
  48.         M/ has a slightly different meaning in L.O.V.E. Forth
  49.  
  50.         M*/ must be loaded from the file MISC.TXT (it is loaded with
  51.         the block disk words).   It assumes the Forth '79 conventions for
  52.         division.
  53.  
  54. Chapter 8   Variables constants and arrays
  55. ---------
  56.         Note that the dictionary structure is different in L.O.V.E.
  57. Forth than what is shown here.  ? is not defined.  Try:
  58.         : ?    @ .   ;
  59.  
  60.         L.O.V.E. Forth defines defines double number words such as 2!
  61. 2@ 2DUP etc.  also as D!  D@  DDUP  which may be more meaningful names
  62. in some applications.
  63.  
  64. Chapter 9   Under the hood
  65. ---------
  66.         The dictionary structure is different in L.O.V.E. Forth from
  67. what is shown.  The word  '  returns the compilation address of the
  68. following word in the thread segment.  This doesn't matter, really.
  69. Words such as EXECUTE and vectored execution as described, all work as
  70. expected.
  71.  
  72.         The word DUMP in L.O.V.E. Forth works from the data segment.
  73. You can use it to show your data.  Use TS:DUMP to see the portion
  74. of your words that are in the thread segment (give it the compilation
  75. address), HS:DUMP from the head segment (>NAME may be used to convert
  76. the compilation address) and CS:DUMP from the code segment (machine
  77. code).
  78.  
  79.         The word @EXECUTE is not present.
  80.  
  81.         The structure of dictionary entries varies from what is shown in
  82. the book.  The main differences occur because L.O.V.E. Forth divides
  83. each word out between various segments.  More is said in accompanying
  84. technical notes, but here is a summary.   The dictionary head,
  85. including the NAME and LINK as described go into the HEAD SEGMENT.
  86. The CODE POINTER and BODY go into the THREAD SEGMENT.   There is one
  87. exception.  VARIABLEs and other data words have their BODY (ie. the
  88. data) stored in the DATA SEGMENT (or VS: for 'variables segment').
  89. When an assembler is used, it's resulting code goes into the CODE
  90. SEGMENT.  The parameter and return stacks are contained in the STACK
  91. SEGMENT.
  92.  
  93.         The word >BODY takes the address from ' (ie. the compilation
  94. address) and returns an address in the data segment (eg. address of
  95. data for a VARIABLE).  The word TS:>BODY takes the address from ' and
  96. returns an address in the thread segment (eg. the body of a colon
  97. definition).  There is no error checking in these words,  if there
  98. isn't, for example, a data segment field for the word that was  'ed the
  99. address returned will be meaningless.
  100.  
  101.         See the file COMPAT.DOC for more information on changing the
  102. values of constants and other issues related to the compatibility of
  103. L.O.V.E. Forth.
  104.  
  105.         The memory map of L.O.V.E. Forth is quit different from that
  106. shown.  Each segment in L.O.V.E. Forth has it's own dictionary pointer.
  107. They are only incremented in segments where data are added. It suffices
  108. to say here simply that the more code you add, the farther up the
  109. dictionary points move.   Try the command MEM-MAP to see the L.O.V.E.
  110. Forth segments and how full they are.
  111.  
  112.         L.O.V.E. Forth does not have an 'electives block'.  It has
  113. however many other files of useful code that you may compile such as
  114. the block words mentioned above.
  115.  
  116.         ALLOT, HERE and PAD work with the VS: in L.O.V.E. Forth.  The
  117. variable DP is reserved for the thread segment and should not be
  118. manipulated casually.
  119.  
  120.         The word EMPTY is not present.
  121.  
  122.         SP@ and S0  are present but return addresses in the STACK
  123. SEGMENT.  Therefore, if we wanted to access the stack area we would use
  124. SS:@  not  @ as described.
  125.  
  126.         TIB returns an address the VS: and works as described.
  127.  
  128.         There are no USER VARIABLES.
  129.  
  130.         BLOCK BUFFERS are in high memory as described (in the VS: too).
  131.  
  132.         Vocabularies are very similar to what is described.  There are
  133. several provided.  ROOT (which contains some words for manipulating
  134. vocabularies), FORTH (with the majority of standard words), MSDOS (with
  135. file handling and other words to access DOS), VIRTUAL (with words for
  136. handling virtual vocabularies), TOOLBOX (with programming utilities).
  137. There are also vocabularies which are loaded instantly when referenced,
  138. called virtual vocabularies.  These are ASSEMBLER, UTILITIES, EDITOR,
  139. SCREEN-UTILS (the latter two are only available when block words are
  140. loaded).
  141.  
  142.         A major difference between L.O.V.E. Forth and what is
  143. described, is that the vocabulary search order in L.O.V.E. Forth is
  144. implemented as a vocabulary stack, the top being the first one
  145. searched.  Executing a vocabulary (ie. the word) makes it the first one
  146. in the search order.  The word ALSO allows a vocabulary to be added to
  147. the search order.  VDROP removes the top one.  CONTEXT always holds the
  148. top of the vocabulary stack.  ONLY resets the vocabulary stack to just
  149. ROOT.  The word DEFINITIONS works as expected.  CONTEXT (ie. the top of
  150. the vocabulary stack) becomes the vocabulary into which new definitions
  151. are added.
  152.  
  153.         Use ORDER to display the current search order, WORDS displays
  154. words from the CONTEXT vocabulary, WORDS> followed by any vocabulary
  155. name, displays words from that vocabulary.   The word DEVELOP resets
  156. the vocabularies to ROOT, FORTH, and TOOLBOX which is the usual order
  157. for normal programming and experimention.  (If in doubt, type DEVELOP).
  158.  
  159. Chapter 10   I/O any you
  160. ----------
  161.          Make sure the block disk words are loaded with
  162.          INCLUDE" LOADBLK.TXT"
  163.  
  164.         The word >TYPE is not defined.
  165.  
  166.         Though CMOVE and CMOVE> are included, the word BMOVE (same
  167. arguments) is much more useful.  It checks prior to the move, whether
  168. there will be any bytes written over by the move, and adjusts the
  169. direction of the move accordingly.  (For all that explanation, the
  170. overhead is very slight).
  171.  
  172.         The word BLANK is not included.  Try:     : BLANK BL FILL ;
  173.  
  174.          L.O.V.E. Forth defines two words to check for keypresses.  The
  175. word QTERM simply checks for a key and returns a flag, true if there is
  176. one available for KEY.  The word  ?TERMINAL  does the same thing, but
  177. removes it if one is found.
  178.  
  179.         The word NUMBER only recognizes a decimal point within a number
  180. being converted.
  181.  
  182.         The word STRING is not provided, but the word   ,"
  183. (comma-quote) provides this function.  The word LIT" is also not
  184. provided.  The word   "  (quote) provides this function, note that it
  185. returns just an address and can be executed from the keyboard as well
  186. (it places the string at PAD).  Note that all string words allow the
  187. inclusion of control characters using UNIX conventions.  See the file
  188. STRINGS.DOC for more information.
  189.  
  190. Chapter 11  Extending the Compiler with Defining and Compiling Words
  191. ----------
  192.         The example given for   dot"  will not operate in L.O.V.E.
  193. Forth because string literals are actually stored in the VS:.   B."
  194. would work however, if the word BRIGHT were available.  The word ASCII
  195. is provided and is state-smart.
  196.  
  197. Chapter 12  3-1/2 Examples
  198. ----------
  199.         The words ASCII and \ are already provided.
  200.  
  201.         The word ,"  is defined differently in the second example.
  202. Either define STRING as   ,"  first, or use   "  instead of ," .
  203.  
  204.         The rpn assember provided with L83 has a similar
  205. implementation, but remember that code goes into the code segment.